﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Oracle.EntityFrameworkCore.Metadata;

namespace SOEI.Solution.Migrations
{
    public partial class NCLF_Oracle_Initial : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.EnsureSchema(
                name: "FGXT_YW");

            migrationBuilder.CreateTable(
                name: "NCLF_AUDITLOGS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    TENANTID = table.Column<int>(nullable: true),
                    USERID = table.Column<long>(nullable: true),
                    SERVICENAME = table.Column<string>(maxLength: 256, nullable: true),
                    METHODNAME = table.Column<string>(maxLength: 256, nullable: true),
                    PARAMETERS = table.Column<string>(maxLength: 1024, nullable: true),
                    RETURNVALUE = table.Column<string>(nullable: true),
                    EXECUTIONTIME = table.Column<DateTime>(nullable: false),
                    EXECUTIONDURATION = table.Column<int>(nullable: false),
                    CLIENTIPADDRESS = table.Column<string>(maxLength: 64, nullable: true),
                    CLIENTNAME = table.Column<string>(maxLength: 128, nullable: true),
                    BROWSERINFO = table.Column<string>(maxLength: 512, nullable: true),
                    EXCEPTION = table.Column<string>(maxLength: 2000, nullable: true),
                    IMPERSONATORUSERID = table.Column<long>(nullable: true),
                    IMPERSONATORTENANTID = table.Column<int>(nullable: true),
                    CUSTOMDATA = table.Column<string>(maxLength: 2000, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_AUDITLOGS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_BACKGROUNDJOBS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    JOBTYPE = table.Column<string>(maxLength: 512, nullable: false),
                    JOBARGS = table.Column<string>(maxLength: 1048576, nullable: false),
                    TRYCOUNT = table.Column<short>(nullable: false),
                    NEXTTRYTIME = table.Column<DateTime>(nullable: false),
                    LASTTRYTIME = table.Column<DateTime>(nullable: true),
                    ISABANDONED = table.Column<bool>(nullable: false),
                    PRIORITY = table.Column<byte>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_BACKGROUNDJOBS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_DYNAMICPROPERTIES",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<int>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    PROPERTYNAME = table.Column<string>(nullable: true),
                    INPUTTYPE = table.Column<string>(nullable: true),
                    PERMISSION = table.Column<string>(nullable: true),
                    TENANTID = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_DP_KEY", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_EDITIONS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<int>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    LASTMODIFIERUSERID = table.Column<long>(nullable: true),
                    ISDELETED = table.Column<bool>(nullable: false),
                    DELETERUSERID = table.Column<long>(nullable: true),
                    DELETIONTIME = table.Column<DateTime>(nullable: true),
                    NAME = table.Column<string>(maxLength: 32, nullable: false),
                    DISPLAYNAME = table.Column<string>(maxLength: 64, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_EDITIONS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_ENTITYCHANGESETS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    BROWSERINFO = table.Column<string>(maxLength: 512, nullable: true),
                    CLIENTIPADDRESS = table.Column<string>(maxLength: 64, nullable: true),
                    CLIENTNAME = table.Column<string>(maxLength: 128, nullable: true),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    EXTENSIONDATA = table.Column<string>(nullable: true),
                    IMPERSONATORTENANTID = table.Column<int>(nullable: true),
                    IMPERSONATORUSERID = table.Column<long>(nullable: true),
                    REASON = table.Column<string>(maxLength: 256, nullable: true),
                    TENANTID = table.Column<int>(nullable: true),
                    USERID = table.Column<long>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_ENTITYCHANGESETS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_LANGUAGES",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<int>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    LASTMODIFIERUSERID = table.Column<long>(nullable: true),
                    ISDELETED = table.Column<bool>(nullable: false),
                    DELETERUSERID = table.Column<long>(nullable: true),
                    DELETIONTIME = table.Column<DateTime>(nullable: true),
                    TENANTID = table.Column<int>(nullable: true),
                    NAME = table.Column<string>(maxLength: 128, nullable: false),
                    DISPLAYNAME = table.Column<string>(maxLength: 64, nullable: false),
                    ICON = table.Column<string>(maxLength: 128, nullable: true),
                    ISDISABLED = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_LANGUAGES", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_LANGUAGETEXTS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    LASTMODIFIERUSERID = table.Column<long>(nullable: true),
                    TENANTID = table.Column<int>(nullable: true),
                    LANGUAGENAME = table.Column<string>(maxLength: 128, nullable: false),
                    SOURCE = table.Column<string>(maxLength: 128, nullable: false),
                    KEY = table.Column<string>(maxLength: 256, nullable: false),
                    VALUE = table.Column<string>(maxLength: 67108864, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_LANGUAGETEXTS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_NOTIFICATIONS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<Guid>(nullable: false),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    NOTIFICATIONNAME = table.Column<string>(maxLength: 96, nullable: false),
                    DATA = table.Column<string>(maxLength: 1048576, nullable: true),
                    DATATYPENAME = table.Column<string>(maxLength: 512, nullable: true),
                    ENTITYTYPENAME = table.Column<string>(maxLength: 250, nullable: true),
                    ENTITYTYPEASSEMBLYQUALIFIEDNAM = table.Column<string>(maxLength: 512, nullable: true),
                    ENTITYID = table.Column<string>(maxLength: 96, nullable: true),
                    SEVERITY = table.Column<byte>(nullable: false),
                    USERIDS = table.Column<string>(maxLength: 131072, nullable: true),
                    EXCLUDEDUSERIDS = table.Column<string>(maxLength: 131072, nullable: true),
                    TENANTIDS = table.Column<string>(maxLength: 131072, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_NOTIFICATIONS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_NOTIFICATIONSUBSCRIPTION",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<Guid>(nullable: false),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    TENANTID = table.Column<int>(nullable: true),
                    USERID = table.Column<long>(nullable: false),
                    NOTIFICATIONNAME = table.Column<string>(maxLength: 96, nullable: true),
                    ENTITYTYPENAME = table.Column<string>(maxLength: 250, nullable: true),
                    ENTITYTYPEASSEMBLYQUALIFIEDNAM = table.Column<string>(maxLength: 512, nullable: true),
                    ENTITYID = table.Column<string>(maxLength: 96, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_NOTIFYSUBSCRIPTION", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_ORGANIZATIONUNITROLES",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    TENANTID = table.Column<int>(nullable: true),
                    ROLEID = table.Column<int>(nullable: false),
                    ORGANIZATIONUNITID = table.Column<long>(nullable: false),
                    ISDELETED = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_ORGANIZATIONUNITROLES", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_ORGANIZATIONUNITS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    LASTMODIFIERUSERID = table.Column<long>(nullable: true),
                    ISDELETED = table.Column<bool>(nullable: false),
                    DELETERUSERID = table.Column<long>(nullable: true),
                    DELETIONTIME = table.Column<DateTime>(nullable: true),
                    TENANTID = table.Column<int>(nullable: true),
                    PARENTID = table.Column<long>(nullable: true),
                    CODE = table.Column<string>(maxLength: 95, nullable: false),
                    DISPLAYNAME = table.Column<string>(maxLength: 128, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_ORGANIZATIONUNITS", x => x.ID);
                    table.ForeignKey(
                        name: "FK_NCLF_ORGANIUNIT_PARENTID",
                        column: x => x.PARENTID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_ORGANIZATIONUNITS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_TENANTNOTIFICATIONS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<Guid>(nullable: false),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    TENANTID = table.Column<int>(nullable: true),
                    NOTIFICATIONNAME = table.Column<string>(maxLength: 96, nullable: false),
                    DATA = table.Column<string>(maxLength: 1048576, nullable: true),
                    DATATYPENAME = table.Column<string>(maxLength: 512, nullable: true),
                    ENTITYTYPENAME = table.Column<string>(maxLength: 250, nullable: true),
                    ENTITYTYPEASSEMBLYQUALIFIEDNAM = table.Column<string>(maxLength: 512, nullable: true),
                    ENTITYID = table.Column<string>(maxLength: 96, nullable: true),
                    SEVERITY = table.Column<byte>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_TENANTNOTIFICATIONS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_USERACCOUNTS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    LASTMODIFIERUSERID = table.Column<long>(nullable: true),
                    ISDELETED = table.Column<bool>(nullable: false),
                    DELETERUSERID = table.Column<long>(nullable: true),
                    DELETIONTIME = table.Column<DateTime>(nullable: true),
                    TENANTID = table.Column<int>(nullable: true),
                    USERID = table.Column<long>(nullable: false),
                    USERLINKID = table.Column<long>(nullable: true),
                    USERNAME = table.Column<string>(maxLength: 256, nullable: true),
                    EMAILADDRESS = table.Column<string>(maxLength: 256, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_USERACCOUNTS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_USERLOGINATTEMPTS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    TENANTID = table.Column<int>(nullable: true),
                    TENANCYNAME = table.Column<string>(maxLength: 64, nullable: true),
                    USERID = table.Column<long>(nullable: true),
                    USERNAMEOREMAILADDRESS = table.Column<string>(maxLength: 256, nullable: true),
                    CLIENTIPADDRESS = table.Column<string>(maxLength: 64, nullable: true),
                    CLIENTNAME = table.Column<string>(maxLength: 128, nullable: true),
                    BROWSERINFO = table.Column<string>(maxLength: 512, nullable: true),
                    RESULT = table.Column<byte>(nullable: false),
                    CREATIONTIME = table.Column<DateTime>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_USERLOGINATTEMPTS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_USERNOTIFICATIONS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<Guid>(nullable: false),
                    TENANTID = table.Column<int>(nullable: true),
                    USERID = table.Column<long>(nullable: false),
                    TENANTNOTIFICATIONID = table.Column<Guid>(nullable: false),
                    STATE = table.Column<int>(nullable: false),
                    CREATIONTIME = table.Column<DateTime>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_USERNOTIFICATIONS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_USERORGANIZATIONUNITS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    TENANTID = table.Column<int>(nullable: true),
                    USERID = table.Column<long>(nullable: false),
                    ORGANIZATIONUNITID = table.Column<long>(nullable: false),
                    ISDELETED = table.Column<bool>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_USERORGANIZATIONUNITS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_USERS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    LASTMODIFIERUSERID = table.Column<long>(nullable: true),
                    ISDELETED = table.Column<bool>(nullable: false),
                    DELETERUSERID = table.Column<long>(nullable: true),
                    DELETIONTIME = table.Column<DateTime>(nullable: true),
                    AUTHENTICATIONSOURCE = table.Column<string>(maxLength: 64, nullable: true),
                    USERNAME = table.Column<string>(maxLength: 256, nullable: false),
                    TENANTID = table.Column<int>(nullable: true),
                    EMAILADDRESS = table.Column<string>(maxLength: 256, nullable: false),
                    NAME = table.Column<string>(maxLength: 64, nullable: false),
                    SURNAME = table.Column<string>(maxLength: 64, nullable: false),
                    PASSWORD = table.Column<string>(maxLength: 128, nullable: false),
                    EMAILCONFIRMATIONCODE = table.Column<string>(maxLength: 328, nullable: true),
                    PASSWORDRESETCODE = table.Column<string>(maxLength: 328, nullable: true),
                    LOCKOUTENDDATEUTC = table.Column<DateTime>(nullable: true),
                    ACCESSFAILEDCOUNT = table.Column<int>(nullable: false),
                    ISLOCKOUTENABLED = table.Column<bool>(nullable: false),
                    PHONENUMBER = table.Column<string>(maxLength: 32, nullable: true),
                    ISPHONENUMBERCONFIRMED = table.Column<bool>(nullable: false),
                    SECURITYSTAMP = table.Column<string>(maxLength: 128, nullable: true),
                    ISTWOFACTORENABLED = table.Column<bool>(nullable: false),
                    ISEMAILCONFIRMED = table.Column<bool>(nullable: false),
                    ISACTIVE = table.Column<bool>(nullable: false),
                    NORMALIZEDUSERNAME = table.Column<string>(maxLength: 256, nullable: false),
                    NORMALIZEDEMAILADDRESS = table.Column<string>(maxLength: 256, nullable: false),
                    CONCURRENCYSTAMP = table.Column<string>(maxLength: 128, nullable: true),
                    ORGANIZEID = table.Column<long>(nullable: true),
                    USERTYPE = table.Column<int>(nullable: false),
                    STATECODE = table.Column<string>(maxLength: 20, nullable: true),
                    ORIGINALNUMBER = table.Column<string>(maxLength: 20, nullable: true),
                    ORIGINALPASSWORD = table.Column<string>(maxLength: 20, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_USERS_ID", x => x.ID);
                    table.ForeignKey(
                        name: "FK_NCLF_USERS_SELF_CREATORUSER",
                        column: x => x.CREATORUSERID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_USERS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_NCLF_USERS_SELF_DELETERUSER",
                        column: x => x.DELETERUSERID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_USERS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_NCLF_USERS_SELF_MODIFIERUSE",
                        column: x => x.LASTMODIFIERUSERID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_USERS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_WEBHOOKEVENTS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<Guid>(nullable: false),
                    WEBHOOKNAME = table.Column<string>(nullable: false),
                    DATA = table.Column<string>(nullable: true),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    TENANTID = table.Column<int>(nullable: true),
                    ISDELETED = table.Column<bool>(nullable: false),
                    DELETIONTIME = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_WEBHOOKEVENTS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_WEBHOOKSUBSCRIPTIONS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<Guid>(nullable: false),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    TENANTID = table.Column<int>(nullable: true),
                    WEBHOOKURI = table.Column<string>(nullable: false),
                    SECRET = table.Column<string>(nullable: false),
                    ISACTIVE = table.Column<bool>(nullable: false),
                    WEBHOOKS = table.Column<string>(nullable: true),
                    HEADERS = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_WEBHOOKSUBSCRIPTIONS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_DYNAMICENTITYPROPERTIES",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<int>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    ENTITYFULLNAME = table.Column<string>(nullable: true),
                    DYNAMICPROPERTYID = table.Column<int>(nullable: false),
                    TENANTID = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_DEP_KEY", x => x.ID);
                    table.ForeignKey(
                        name: "FK_NCLF_DEP_DP_DP_ID",
                        column: x => x.DYNAMICPROPERTYID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_DYNAMICPROPERTIES",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_DYNAMICPROPERTYVALUES",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<int>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    VALUE = table.Column<string>(nullable: false),
                    TENANTID = table.Column<int>(nullable: true),
                    DYNAMICPROPERTYID = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_DPV_KEY", x => x.ID);
                    table.ForeignKey(
                        name: "FK_NCLF_DP_DP_ID",
                        column: x => x.DYNAMICPROPERTYID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_DYNAMICPROPERTIES",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_FEATURES",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    TENANTID = table.Column<int>(nullable: true),
                    NAME = table.Column<string>(maxLength: 128, nullable: false),
                    VALUE = table.Column<string>(maxLength: 2000, nullable: false),
                    Discriminator = table.Column<string>(nullable: false),
                    EDITIONID = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_FEATURE_KEY", x => x.ID);
                    table.ForeignKey(
                        name: "FK_NCLF_FEATURES_EDITIONID",
                        column: x => x.EDITIONID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_EDITIONS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_ENTITYCHANGES",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CHANGETIME = table.Column<DateTime>(nullable: false),
                    CHANGETYPE = table.Column<byte>(nullable: false),
                    ENTITYCHANGESETID = table.Column<long>(nullable: false),
                    ENTITYID = table.Column<string>(maxLength: 48, nullable: true),
                    ENTITYTYPEFULLNAME = table.Column<string>(maxLength: 192, nullable: true),
                    TENANTID = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_ENTITYCHANGES", x => x.ID);
                    table.ForeignKey(
                        name: "FK_NCLF_ECHANGESET_ECHANGE_SET",
                        column: x => x.ENTITYCHANGESETID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_ENTITYCHANGESETS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_ROLES",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<int>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    LASTMODIFIERUSERID = table.Column<long>(nullable: true),
                    ISDELETED = table.Column<bool>(nullable: false),
                    DELETERUSERID = table.Column<long>(nullable: true),
                    DELETIONTIME = table.Column<DateTime>(nullable: true),
                    TENANTID = table.Column<int>(nullable: true),
                    NAME = table.Column<string>(maxLength: 32, nullable: false),
                    DISPLAYNAME = table.Column<string>(maxLength: 64, nullable: false),
                    ISSTATIC = table.Column<bool>(nullable: false),
                    ISDEFAULT = table.Column<bool>(nullable: false),
                    NORMALIZEDNAME = table.Column<string>(maxLength: 32, nullable: false),
                    CONCURRENCYSTAMP = table.Column<string>(maxLength: 128, nullable: true),
                    DESCRIPTION = table.Column<string>(maxLength: 5000, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_ROLES", x => x.ID);
                    table.ForeignKey(
                        name: "FK_NCLF_ROLE_CREATORUSERID",
                        column: x => x.CREATORUSERID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_USERS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_NCLF_ROLE_DELETERUSERID",
                        column: x => x.DELETERUSERID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_USERS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_NCLF_ROLE_MODIFIERUSERID",
                        column: x => x.LASTMODIFIERUSERID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_USERS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_SETTINGS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    LASTMODIFIERUSERID = table.Column<long>(nullable: true),
                    TENANTID = table.Column<int>(nullable: true),
                    USERID = table.Column<long>(nullable: true),
                    NAME = table.Column<string>(maxLength: 256, nullable: false),
                    VALUE = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_SETTINGS", x => x.ID);
                    table.ForeignKey(
                        name: "FK_NCLF_SETTING_USERS_USERID",
                        column: x => x.USERID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_USERS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_TENANTS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<int>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    LASTMODIFIERUSERID = table.Column<long>(nullable: true),
                    ISDELETED = table.Column<bool>(nullable: false),
                    DELETERUSERID = table.Column<long>(nullable: true),
                    DELETIONTIME = table.Column<DateTime>(nullable: true),
                    TENANCYNAME = table.Column<string>(maxLength: 64, nullable: false),
                    NAME = table.Column<string>(maxLength: 128, nullable: false),
                    CONNECTIONSTRING = table.Column<string>(maxLength: 1024, nullable: true),
                    ISACTIVE = table.Column<bool>(nullable: false),
                    EDITIONID = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_TENANTS", x => x.ID);
                    table.ForeignKey(
                        name: "FK_NCLF_TENANT_CREATORUSERID",
                        column: x => x.CREATORUSERID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_USERS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_NCLF_TENANT_DELETERUSERID",
                        column: x => x.DELETERUSERID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_USERS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_NCLF_TENANTS_EDITIONS_EDITI",
                        column: x => x.EDITIONID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_EDITIONS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_NCLF_TENANT_MODIFIERUSERID",
                        column: x => x.LASTMODIFIERUSERID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_USERS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_USERCLAIMS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    TENANTID = table.Column<int>(nullable: true),
                    USERID = table.Column<long>(nullable: false),
                    CLAIMTYPE = table.Column<string>(maxLength: 256, nullable: true),
                    CLAIMVALUE = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_USERCLAIMS", x => x.ID);
                    table.ForeignKey(
                        name: "FK_NCLF_USERCLAIMS_USERS_USERI",
                        column: x => x.USERID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_USERS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_USERLOGINS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    TENANTID = table.Column<int>(nullable: true),
                    USERID = table.Column<long>(nullable: false),
                    LOGINPROVIDER = table.Column<string>(maxLength: 128, nullable: false),
                    PROVIDERKEY = table.Column<string>(maxLength: 256, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_USERLOGINS", x => x.ID);
                    table.ForeignKey(
                        name: "FK_NCLF_USERLOGIN_USERS_USERID",
                        column: x => x.USERID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_USERS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_USERROLES",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    TENANTID = table.Column<int>(nullable: true),
                    USERID = table.Column<long>(nullable: false),
                    ROLEID = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_USERROLES", x => x.ID);
                    table.ForeignKey(
                        name: "FK_NCLF_USERROLES_USERS_USERID",
                        column: x => x.USERID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_USERS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_USERTOKENS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    TENANTID = table.Column<int>(nullable: true),
                    USERID = table.Column<long>(nullable: false),
                    LOGINPROVIDER = table.Column<string>(maxLength: 128, nullable: true),
                    NAME = table.Column<string>(maxLength: 128, nullable: true),
                    VALUE = table.Column<string>(maxLength: 512, nullable: true),
                    EXPIREDATE = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_USERTOKENS", x => x.ID);
                    table.ForeignKey(
                        name: "FK_NCLF_USERTOKENS_USERS_USERI",
                        column: x => x.USERID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_USERS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_WEBHOOKSENDATTEMPTS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<Guid>(nullable: false),
                    WEBHOOKEVENTID = table.Column<Guid>(nullable: false),
                    WEBHOOKSUBSCRIPTIONID = table.Column<Guid>(nullable: false),
                    RESPONSE = table.Column<string>(nullable: true),
                    ResponseStatusCode = table.Column<int>(nullable: true),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    TENANTID = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_WEBHOOKSENDATTEMPTS", x => x.ID);
                    table.ForeignKey(
                        name: "FK_NCLF_WHOOKSEND_HOOKEVENTS_W",
                        column: x => x.WEBHOOKEVENTID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_WEBHOOKEVENTS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_DYENTITYPROPERTYVALUES",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<int>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    VALUE = table.Column<string>(nullable: false),
                    ENTITYID = table.Column<string>(nullable: true),
                    DYNAMICENTITYPROPERTYID = table.Column<int>(nullable: false),
                    TENANTID = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_DEPV_KEY", x => x.ID);
                    table.ForeignKey(
                        name: "FK_NCLF_DEPV_DEP_ID",
                        column: x => x.DYNAMICENTITYPROPERTYID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_DYNAMICENTITYPROPERTIES",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_ENTITYPROPERTYCHANGES",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    ENTITYCHANGEID = table.Column<long>(nullable: false),
                    NEWVALUE = table.Column<string>(maxLength: 512, nullable: true),
                    ORIGINALVALUE = table.Column<string>(maxLength: 512, nullable: true),
                    PROPERTYNAME = table.Column<string>(maxLength: 96, nullable: true),
                    PROPERTYTYPEFULLNAME = table.Column<string>(maxLength: 192, nullable: true),
                    TENANTID = table.Column<int>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_ENTITYPROPERTYCHANGES", x => x.ID);
                    table.ForeignKey(
                        name: "FK_NCLF_SELF_ENTITYCHANGEID",
                        column: x => x.ENTITYCHANGEID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_ENTITYCHANGES",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_PERMISSIONS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    TENANTID = table.Column<int>(nullable: true),
                    NAME = table.Column<string>(maxLength: 128, nullable: false),
                    ISGRANTED = table.Column<bool>(nullable: false),
                    Discriminator = table.Column<string>(nullable: false),
                    ROLEID = table.Column<int>(nullable: true),
                    USERID = table.Column<long>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_PERMISSIONS", x => x.ID);
                    table.ForeignKey(
                        name: "FK_NCLF_PERMISSIONS_ROLES_ROLE",
                        column: x => x.ROLEID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_ROLES",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_NCLF_PERMISSIONS_USERS_USER",
                        column: x => x.USERID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_USERS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_ROLECLAIMS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    TENANTID = table.Column<int>(nullable: true),
                    ROLEID = table.Column<int>(nullable: false),
                    CLAIMTYPE = table.Column<string>(maxLength: 256, nullable: true),
                    CLAIMVALUE = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_ROLECLAIMS", x => x.ID);
                    table.ForeignKey(
                        name: "FK_NCLF_ROLECLAIMS_ROLES_ROLEI",
                        column: x => x.ROLEID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_ROLES",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_AUDITLOGS_EXECUTIONDUR",
                schema: "FGXT_YW",
                table: "NCLF_AUDITLOGS",
                columns: new[] { "TENANTID", "EXECUTIONDURATION" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_AUDITLOGS_EXECUTIONTIM",
                schema: "FGXT_YW",
                table: "NCLF_AUDITLOGS",
                columns: new[] { "TENANTID", "EXECUTIONTIME" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_AUDITLOGS_USERID",
                schema: "FGXT_YW",
                table: "NCLF_AUDITLOGS",
                columns: new[] { "TENANTID", "USERID" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_BACKGROUNDJOB_NEXTTRYT",
                schema: "FGXT_YW",
                table: "NCLF_BACKGROUNDJOBS",
                columns: new[] { "ISABANDONED", "NEXTTRYTIME" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_D_E_PROPERTYID",
                schema: "FGXT_YW",
                table: "NCLF_DYENTITYPROPERTYVALUES",
                column: "DYNAMICENTITYPROPERTYID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_DYENTITY_PROPID",
                schema: "FGXT_YW",
                table: "NCLF_DYNAMICENTITYPROPERTIES",
                column: "DYNAMICPROPERTYID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_DYENTITY_EFN_DPID_TID",
                schema: "FGXT_YW",
                table: "NCLF_DYNAMICENTITYPROPERTIES",
                columns: new[] { "ENTITYFULLNAME", "DYNAMICPROPERTYID", "TENANTID" },
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_DP_PN_TID",
                schema: "FGXT_YW",
                table: "NCLF_DYNAMICPROPERTIES",
                columns: new[] { "PROPERTYNAME", "TENANTID" },
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_DPV_DPID",
                schema: "FGXT_YW",
                table: "NCLF_DYNAMICPROPERTYVALUES",
                column: "DYNAMICPROPERTYID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_ENTITYCHANGES_CHANGESE",
                schema: "FGXT_YW",
                table: "NCLF_ENTITYCHANGES",
                column: "ENTITYCHANGESETID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_ENTITYCHANGES_ENTITYID",
                schema: "FGXT_YW",
                table: "NCLF_ENTITYCHANGES",
                columns: new[] { "ENTITYTYPEFULLNAME", "ENTITYID" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_CHANGESET_CREATIONTIME",
                schema: "FGXT_YW",
                table: "NCLF_ENTITYCHANGESETS",
                columns: new[] { "TENANTID", "CREATIONTIME" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_CHANGESET_REASON",
                schema: "FGXT_YW",
                table: "NCLF_ENTITYCHANGESETS",
                columns: new[] { "TENANTID", "REASON" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_CHANGESET_USERID",
                schema: "FGXT_YW",
                table: "NCLF_ENTITYCHANGESETS",
                columns: new[] { "TENANTID", "USERID" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_PROPERTYCHANGES_CHANGE",
                schema: "FGXT_YW",
                table: "NCLF_ENTITYPROPERTYCHANGES",
                column: "ENTITYCHANGEID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_FEATURES_EFSID_NAME",
                schema: "FGXT_YW",
                table: "NCLF_FEATURES",
                columns: new[] { "EDITIONID", "NAME" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_FEATURES_TFSID_NAME",
                schema: "FGXT_YW",
                table: "NCLF_FEATURES",
                columns: new[] { "TENANTID", "NAME" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_LANGUAGE_TENANTID_NAME",
                schema: "FGXT_YW",
                table: "NCLF_LANGUAGES",
                columns: new[] { "TENANTID", "NAME" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_LANGUAGETEXTS_T_S_LANG",
                schema: "FGXT_YW",
                table: "NCLF_LANGUAGETEXTS",
                columns: new[] { "TENANTID", "SOURCE", "LANGUAGENAME", "KEY" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_SUBSCRIPTION_N_E_ID_US",
                schema: "FGXT_YW",
                table: "NCLF_NOTIFICATIONSUBSCRIPTION",
                columns: new[] { "NOTIFICATIONNAME", "ENTITYTYPENAME", "ENTITYID", "USERID" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_SUBSCRIPTION_T_N_E_ID_",
                schema: "FGXT_YW",
                table: "NCLF_NOTIFICATIONSUBSCRIPTION",
                columns: new[] { "TENANTID", "NOTIFICATIONNAME", "ENTITYTYPENAME", "ENTITYID", "USERID" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_OUROLES_TENANTID_OUNIT",
                schema: "FGXT_YW",
                table: "NCLF_ORGANIZATIONUNITROLES",
                columns: new[] { "TENANTID", "ORGANIZATIONUNITID" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_OUROLES_TENANTID_ROLEI",
                schema: "FGXT_YW",
                table: "NCLF_ORGANIZATIONUNITROLES",
                columns: new[] { "TENANTID", "ROLEID" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_ORGUNITS_PARENTID",
                schema: "FGXT_YW",
                table: "NCLF_ORGANIZATIONUNITS",
                column: "PARENTID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_ORGUNITS_TENANTID_CODE",
                schema: "FGXT_YW",
                table: "NCLF_ORGANIZATIONUNITS",
                columns: new[] { "TENANTID", "CODE" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_PERMISSIONS_TENANTID_N",
                schema: "FGXT_YW",
                table: "NCLF_PERMISSIONS",
                columns: new[] { "TENANTID", "NAME" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_PERMISSIONS_ROLEID",
                schema: "FGXT_YW",
                table: "NCLF_PERMISSIONS",
                column: "ROLEID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_PERMISSIONS_USERID",
                schema: "FGXT_YW",
                table: "NCLF_PERMISSIONS",
                column: "USERID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_ROLECLAIMS_ROLEID",
                schema: "FGXT_YW",
                table: "NCLF_ROLECLAIMS",
                column: "ROLEID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_ROLECLAIMS_TENANTID_CT",
                schema: "FGXT_YW",
                table: "NCLF_ROLECLAIMS",
                columns: new[] { "TENANTID", "CLAIMTYPE" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_ROLES_CREATORUSERID",
                schema: "FGXT_YW",
                table: "NCLF_ROLES",
                column: "CREATORUSERID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_ROLES_DELETERUSERID",
                schema: "FGXT_YW",
                table: "NCLF_ROLES",
                column: "DELETERUSERID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_ROLES_LASTMODIFIERUSER",
                schema: "FGXT_YW",
                table: "NCLF_ROLES",
                column: "LASTMODIFIERUSERID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_ROLES_TID_NORMALIZEDNA",
                schema: "FGXT_YW",
                table: "NCLF_ROLES",
                columns: new[] { "TENANTID", "NORMALIZEDNAME" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_SETTINGS_USERID",
                schema: "FGXT_YW",
                table: "NCLF_SETTINGS",
                column: "USERID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_SETTINGS_TENID_NAME_US",
                schema: "FGXT_YW",
                table: "NCLF_SETTINGS",
                columns: new[] { "TENANTID", "NAME", "USERID" },
                unique: true);

            migrationBuilder.CreateIndex(
                name: "FK_NCLF_TNOTIFICATIONS_TENANTI",
                schema: "FGXT_YW",
                table: "NCLF_TENANTNOTIFICATIONS",
                column: "TENANTID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_TENANTS_CREATORUSERID",
                schema: "FGXT_YW",
                table: "NCLF_TENANTS",
                column: "CREATORUSERID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_TENANTS_DELETERUSERID",
                schema: "FGXT_YW",
                table: "NCLF_TENANTS",
                column: "DELETERUSERID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_TENANTS_EDITIONID",
                schema: "FGXT_YW",
                table: "NCLF_TENANTS",
                column: "EDITIONID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_TENANTS_MODIFIERUSERID",
                schema: "FGXT_YW",
                table: "NCLF_TENANTS",
                column: "LASTMODIFIERUSERID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_TENANTS_TENANCYNAME",
                schema: "FGXT_YW",
                table: "NCLF_TENANTS",
                column: "TENANCYNAME");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_ACCOUNTS_EMAIL",
                schema: "FGXT_YW",
                table: "NCLF_USERACCOUNTS",
                column: "EMAILADDRESS");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_ACCOUNTS_USERNAME",
                schema: "FGXT_YW",
                table: "NCLF_USERACCOUNTS",
                column: "USERNAME");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_ACCOUNTS_TID_EMAIL",
                schema: "FGXT_YW",
                table: "NCLF_USERACCOUNTS",
                columns: new[] { "TENANTID", "EMAILADDRESS" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_ACCOUNTS_TID_USERID",
                schema: "FGXT_YW",
                table: "NCLF_USERACCOUNTS",
                columns: new[] { "TENANTID", "USERID" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_ACCOUNTS_TID_USERNAME",
                schema: "FGXT_YW",
                table: "NCLF_USERACCOUNTS",
                columns: new[] { "TENANTID", "USERNAME" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_UCLAIMS_USERID",
                schema: "FGXT_YW",
                table: "NCLF_USERCLAIMS",
                column: "USERID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_UCLAIMS_TID_CLAIMTYPE",
                schema: "FGXT_YW",
                table: "NCLF_USERCLAIMS",
                columns: new[] { "TENANTID", "CLAIMTYPE" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_LOGINATT_UID_TID",
                schema: "FGXT_YW",
                table: "NCLF_USERLOGINATTEMPTS",
                columns: new[] { "USERID", "TENANTID" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_LOGINATT_TNAME_EMAIL_R",
                schema: "FGXT_YW",
                table: "NCLF_USERLOGINATTEMPTS",
                columns: new[] { "TENANCYNAME", "USERNAMEOREMAILADDRESS", "RESULT" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_ULOGINS_USERID",
                schema: "FGXT_YW",
                table: "NCLF_USERLOGINS",
                column: "USERID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_ULOGINS_TID_UID",
                schema: "FGXT_YW",
                table: "NCLF_USERLOGINS",
                columns: new[] { "TENANTID", "USERID" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_ULOGINS_TID_LP_PK",
                schema: "FGXT_YW",
                table: "NCLF_USERLOGINS",
                columns: new[] { "TENANTID", "LOGINPROVIDER", "PROVIDERKEY" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_USERNOTIFI_UID_STE_CTI",
                schema: "FGXT_YW",
                table: "NCLF_USERNOTIFICATIONS",
                columns: new[] { "USERID", "STATE", "CREATIONTIME" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_USERORGUNITS_TID_ORGUN",
                schema: "FGXT_YW",
                table: "NCLF_USERORGANIZATIONUNITS",
                columns: new[] { "TENANTID", "ORGANIZATIONUNITID" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_USERORGUNITS_TID_UID",
                schema: "FGXT_YW",
                table: "NCLF_USERORGANIZATIONUNITS",
                columns: new[] { "TENANTID", "USERID" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_USERROLES_USERID",
                schema: "FGXT_YW",
                table: "NCLF_USERROLES",
                column: "USERID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_USERROLES_TID_RID",
                schema: "FGXT_YW",
                table: "NCLF_USERROLES",
                columns: new[] { "TENANTID", "ROLEID" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_USERROLES_TID_UID",
                schema: "FGXT_YW",
                table: "NCLF_USERROLES",
                columns: new[] { "TENANTID", "USERID" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_USERS_CREATORUSERID",
                schema: "FGXT_YW",
                table: "NCLF_USERS",
                column: "CREATORUSERID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_USERS_DELETERUSERID",
                schema: "FGXT_YW",
                table: "NCLF_USERS",
                column: "DELETERUSERID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_USERS_MODIFIERUSERID",
                schema: "FGXT_YW",
                table: "NCLF_USERS",
                column: "LASTMODIFIERUSERID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_USERS_TID_EMAIL",
                schema: "FGXT_YW",
                table: "NCLF_USERS",
                columns: new[] { "TENANTID", "NORMALIZEDEMAILADDRESS" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_USERS_TID_NUSERNAME",
                schema: "FGXT_YW",
                table: "NCLF_USERS",
                columns: new[] { "TENANTID", "NORMALIZEDUSERNAME" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_UTOKENS_USERID",
                schema: "FGXT_YW",
                table: "NCLF_USERTOKENS",
                column: "USERID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_UTOKENS_TID_USERID",
                schema: "FGXT_YW",
                table: "NCLF_USERTOKENS",
                columns: new[] { "TENANTID", "USERID" });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_WSA_WEBHOOKEVENTID",
                schema: "FGXT_YW",
                table: "NCLF_WEBHOOKSENDATTEMPTS",
                column: "WEBHOOKEVENTID");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "NCLF_AUDITLOGS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_BACKGROUNDJOBS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_DYENTITYPROPERTYVALUES",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_DYNAMICPROPERTYVALUES",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_ENTITYPROPERTYCHANGES",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_FEATURES",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_LANGUAGES",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_LANGUAGETEXTS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_NOTIFICATIONS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_NOTIFICATIONSUBSCRIPTION",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_ORGANIZATIONUNITROLES",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_ORGANIZATIONUNITS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_PERMISSIONS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_ROLECLAIMS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_SETTINGS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_TENANTNOTIFICATIONS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_TENANTS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_USERACCOUNTS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_USERCLAIMS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_USERLOGINATTEMPTS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_USERLOGINS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_USERNOTIFICATIONS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_USERORGANIZATIONUNITS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_USERROLES",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_USERTOKENS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_WEBHOOKSENDATTEMPTS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_WEBHOOKSUBSCRIPTIONS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_DYNAMICENTITYPROPERTIES",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_ENTITYCHANGES",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_ROLES",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_EDITIONS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_WEBHOOKEVENTS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_DYNAMICPROPERTIES",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_ENTITYCHANGESETS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_USERS",
                schema: "FGXT_YW");
        }
    }
}
